home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / cvs-1.8 / cvs-1 / cvs-1.8.1 / src / hash.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-06  |  1.4 KB  |  59 lines

  1. /* $CVSid: @(#)hash.h 1.23 94/10/07 $     */
  2.  
  3. /*
  4.  * Copyright (c) 1992, Brian Berliner and Jeff Polk
  5.  * 
  6.  * You may distribute under the terms of the GNU General Public License as
  7.  * specified in the README file that comes with the CVS 1.4 kit.
  8.  */
  9.  
  10. /*
  11.  * The number of buckets for the hash table contained in each list.  This
  12.  * should probably be prime.
  13.  */
  14. #define HASHSIZE    151
  15.  
  16. /*
  17.  * Types of nodes
  18.  */
  19. enum ntype
  20. {
  21.     UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
  22.     RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE, FILEATTR,
  23.     VARIABLE
  24. };
  25. typedef enum ntype Ntype;
  26.  
  27. struct node
  28. {
  29.     Ntype type;
  30.     struct node *next;
  31.     struct node *prev;
  32.     struct node *hashnext;
  33.     struct node *hashprev;
  34.     char *key;
  35.     char *data;
  36.     void (*delproc) ();
  37. };
  38. typedef struct node Node;
  39.  
  40. struct list
  41. {
  42.     Node *list;
  43.     Node *hasharray[HASHSIZE];
  44.     struct list *next;
  45. };
  46. typedef struct list List;
  47.  
  48. List *getlist PROTO((void));
  49. Node *findnode PROTO((List * list, const char *key));
  50. Node *findnode_fn PROTO((List * list, const char *key));
  51. Node *getnode PROTO((void));
  52. int addnode PROTO((List * list, Node * p));
  53. int walklist PROTO((List * list, int (*)(Node *n, void *closure), void *closure));
  54. int list_isempty PROTO ((List *list));
  55. void dellist PROTO((List ** listp));
  56. void delnode PROTO((Node * p));
  57. void freenode PROTO((Node * p));
  58. void sortlist PROTO((List * list, int (*)(const Node *, const Node *)));
  59.